package ycl.schedule.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ycl.common.base.controller.BaseController;
import ycl.common.models.base.A;
import ycl.common.result.Result;
import ycl.schedule.entity.ScheduleThesaurus;
import ycl.schedule.req.ScheduleThesaurusReq;
import ycl.schedule.res.ScheduleThesaurusRes;
import ycl.schedule.service.ScheduleThesaurusService;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * <p>
 * 日程词库 前端控制器
 * </p>
 *
 * @author ycl
 * @since 2022-06-23 20:21:11
 */
@RestController
@RequestMapping("/schedule-thesaurus")
public class ScheduleThesaurusController
		extends BaseController<ScheduleThesaurus, ScheduleThesaurusReq, ScheduleThesaurusRes> {

	@Resource
	private ScheduleThesaurusService scheduleThesaurusService;

	@Override
	public Result<Page<ScheduleThesaurusRes>> pageList(HttpServletRequest request, ScheduleThesaurus scheduleThesaurus) {
		return Result.success(scheduleThesaurusService.pageList(request, scheduleThesaurus, ScheduleThesaurusRes.class));
	}

	@Override
	public <E extends ScheduleThesaurusReq> Result<A> save(HttpServletRequest request, @Valid E e) {
		scheduleThesaurusService.save(request, e, ScheduleThesaurus.class);
		return Result.success();
	}

	@Override
	public <E extends ScheduleThesaurusReq> Result<A> update(HttpServletRequest request, @Valid E e) {
		scheduleThesaurusService.update(request, e, ScheduleThesaurus.class);
		return Result.success();
	}
}

